import request from '@/utils/request'
import { LoginForm, AxiosResData, UserInfo } from './type'

enum API {
  LOGIN_URL = '/admin/acl/index/login',
  LOGOUT_URL = '/admin/acl/index/logout',
  USERINFO_URL = '/admin/acl/index/info'
}

// 登录接口
export const postUserInfo = (data: LoginForm) => {
  return request.post<any, AxiosResData<string>>(API.LOGIN_URL, data)
}

// 退出登录
export const reqLogout = () => {
  return request.post<any, any>(API.LOGOUT_URL)
}

// 获取用户信息
export const getUserInfo = () => {
  return request.get<any, AxiosResData<UserInfo>>(API.USERINFO_URL)
}
